package net.dl.ss.dao.ibatis;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import net.dl.ss.dao.CategDanceDao;

public class CategDanceDaoIbatis extends CommonDaoIbatis implements CategDanceDao {

	protected String getTypeAlias() {
        return "CategDance";
    }
	
    /**
     * Ibatis implememtation of common interface purposed to delete row from database by identifier.
     *
     * @param id value of persistent object identifier
     */
    public void deleteByCategAndDance(Long categoryId, Long danceId) {
        try {
            getClient().startTransaction();
            try {
                Map<String, Long> params = new HashMap<String, Long>();
                params.put("categoryId", categoryId);
                params.put("danceId", danceId);

            	getClient().delete(getTypeAlias()+".deleteByCategAndDance", params);
                getClient().commitTransaction();
            } finally {
                getClient().endTransaction();
            }
        } catch(SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
